package JAVA300.第十一章多线程;

import java.util.Map;

/**
 * 婚庆公司模拟理解静态代理
 */

public class thread_07_staticProxy {

    public static void main(String[] args) {

        new company(new couple()).happyWedding();
        //对比 new Thread（线程对象）.start()
    }
}

interface MaryWedding{
    void happyWedding();

}

class couple implements MaryWedding {
    @Override
    public void happyWedding() {
        System.out.println("这是新人的操作");
    }
}

class company implements MaryWedding{

    private MaryWedding maryWedding;

    public company(MaryWedding maryWedding) {
        this.maryWedding = maryWedding;
    }

    @Override
    public void happyWedding() {

        ready();//后期可以用作登录退出记录
        this.maryWedding.happyWedding();
        after();


    }

    private void ready(){
        System.out.println("做准备工作");
    }

    private void after(){
        System.out.println("收拾结束");
    }
}
